package class_and_object;

import java.util.Scanner;

/**
 * @author haomin
 * @date 2022/05/27 15:24
 **/
public class Reserve {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String str = in.nextLine();
        System.out.println("该字符串是否为字符串："+isReserve(str));
    }

    private static boolean isReserve(String str) {
        String s1 = filer(str);
        String s2 = reverse(str);
        s2 = filer(s2);
        System.out.println(s1+"ss"+s2);


        return s2.equals(s1);
    }

    private static String filer(String str) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < str.length(); i++) {
            if(Character.isLetterOrDigit(str.charAt(i))){
                sb.append(str.charAt(i));
            }
        }
        return sb.toString();
    }

    private static String reverse(String str) {
        StringBuilder sb = new StringBuilder(str);
        sb.reverse();
        return sb.toString();
    }
}